package com.liangzhong.model.friend.vo
{
	import com.liangzhong.model.playerCenter.vo.PlayerVo;

	/**
	 *好友信息  
	 * @author Administrator
	 * 
	 */	
	public class FriendInfoVo extends FriendVo
	{
		/**
		 *联盟ID 
		 */
		public var unionid:int;
		/**
		 *联盟名称  
		 */
		public var unionname:String;
		/**
		 *天梯排名 
		 */
		public var ttsort:int;
		/**
		 *能力最高的球员 
		 */
		public var highPlayerList:Array;
		/**
		 *场上球员 
		 */
		public var playerList:Array;
		/**
		 *成就 
		 */
		public var achieveList:Array;  
		
		/**
		 *是否需要请求数据
		 * 区别信息面板上的挑战和其他挑战的操作
		 * true需要请求数据false不需要 
		 */
		public var isRequestInfo:Boolean;
		
		/**
		 *是需要开始计时
		 * true开始计时进入比赛（匹配）
		 * false不需要匹配 
		 */
		public var isStartTime:Boolean;
		/**
		 *是否更新数据 
		 */
		public var isUpdata:Boolean;
		
		/**
		 *好友挑战次数 
		 */
		public var friendcount:int;
		
		public function FriendInfoVo()
		{
			super();
		}
		/**
		 *获得数据 
		 * @param $obj
		 * 
		 */
		public function getData($obj:Object):void
		{
			analsysBaseInfo($obj.clubinfo);
			hightPlayer($obj.player);
			var playerVo:PlayerVo;
			var arr:Array ;
			var len:int;
			var i:int;
			arr = $obj.playerformat;
			len = arr.length;
			playerList = [];
			for(i = 0;i < len;i++)
			{
				playerVo = new PlayerVo();
			
				
				playerVo.analysisData(arr[i]);
				playerList.push(playerVo);
				if(playerVo.self == 1)
				{
					playerVo.setStartVo();
					playerVo.starVo.name = uname;
					playerVo.starVo.pname = uname;
				}
				
				//需要转换xy轴
				var tempx:int;
				var tempy:int;
				tempx =playerVo.flasx * 247 /336///267 - playerVo.flasx * 247/332;
				tempy = playerVo.flasy * 320/415 ;/// * 319/300;
				playerVo.flasx = tempx// - 50
				playerVo.flasy = tempy  
			}
			achieveList = [];
			arr = $obj.achieveinfo;
			len = arr.length;
			//成就解析 
			for(i = 0;i < len;i++)
			{
				
			}
			
		}
		
		/**
		 *解析基础数据 
		 * @param $obj
		 * 
		 */
		public function analsysBaseInfo($obj:Object):void
		{
			var obj:Object = $obj;
			var str:String;
			for(str in obj)
			{
				if(this.hasOwnProperty(str))
				{
					this[str] = obj[str];
				}
			}
		}
		/**
		 *解析 最高的能力球员  
		 * @param $obj
		 * 
		 */
		public function hightPlayer($arr:Array):void
		{
			var arr:Array = $arr;
			var len:int;
			var i:int;
			var playerVo:PlayerVo;
			len = arr.length;
			highPlayerList = [];
			for(i = 0;i < len;i++)
			{
				playerVo = new PlayerVo();
				playerVo.analysisData(arr[i]);
				highPlayerList.push(playerVo);
				if(playerVo.self == 1)
				{
					playerVo.setStartVo();
					playerVo.starVo.name = uname;
					playerVo.starVo.pname = uname;
				}
			}
		}
	}
}